package com.visionblue.business.ship.model.repository.db

import androidx.room.*

/**
 * @author: xlh
 * @date: 2020-06-05 10:51 AM
 * @desc:
 */
@Dao
interface CachedOrderDao {

    @Insert
    suspend fun insert(order: CachedOrder)

    @Query("SELECT * FROM cached_order")
    suspend fun getAll(): List<CachedOrder>

    @Update
    suspend fun update(order: CachedOrder)

    @Query("SELECT * FROM cached_order WHERE id = :id")
    suspend fun getOrderById(id: Long): CachedOrder

    @Delete
    suspend fun delete(order: CachedOrder)

    @Query("select * from cached_order where application_id=:applicationId")
    suspend fun findOrderByApplicationId(applicationId: String): CachedOrder
}